package com.woniu.airent.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.airent.dto.HouseDto;
import com.woniu.airent.mapper.HouseManageMapper;
import com.woniu.airent.service.HouseManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HouseManageServiceImpl implements HouseManageService {

    @Autowired
    HouseManageMapper manageMapper;


    @Override
    public PageInfo<HouseDto> listInfor(int currentPage, int pageSize) {
        PageHelper.startPage(currentPage, pageSize);
        List<HouseDto> houseDtoList = manageMapper.selectAllHouse();
        PageInfo<HouseDto> houseDtoPageInfo = new PageInfo<>(houseDtoList);
        return houseDtoPageInfo;
    }

    @Override
    public HouseDto showInfor(int id) {
        HouseDto house = manageMapper.selectHouseById(id);

        return house;
    }
}
